<?php

require_once('request/AbstractRequest.class.php');

class FetchUsersRequest extends AbstractRequest {
	
	private $_out = '';
	
	/**
	 * Core fetch method.
	 *
	 * @param SimpleXML $requestXml not used by fetches
	 */
	protected final function internalExecute($requestXml) {
		if(false) $requestXml; // Zend Studio hack to get rid of warning
		
		$this->out('<Users>');
		
		$rows = $this->userDao->fetchUsers();
		foreach($rows as $row) {
			$user_id = $row['user_id'];
			$username = $row['username'];
			
			$this->out('<User>');
			$this->out('<UserId>' . $user_id . '</UserId>');
			$this->out('<Username>' . wrapCData($username) . '</Username>');
			$this->out('</User>');
		}

		$this->out('</Users>');
		
		echo $this->_out;
	}
	
	private function out($text) {
		$this->_out .= $text . "\n";
	}
	
}

?>